<template>
	<el-form-item :label="meta.memo" :required="meta.tagNeed" :prop="meta.name">
		<template v-if="meta.component">
			<plugin-pack :component="meta.component" :componentParam="formData">
				<el-button type="primary" link>{{ meta.memo }}</el-button>
			</plugin-pack>
		</template>
		<template v-else-if="meta.dictList">
			<n-com-select v-model="formData[meta.name]" :dictList="meta.dictList" :memo="meta.memo" />
		</template>
		<template v-else-if="meta.type === 3">
			<el-date-picker v-model="formData[meta.name]" type="datetime" :placeholder="`请输入${meta.memo}`"
				value-format="x" style="width: 100%;" />
		</template>
		<template v-else-if="meta.type === 140">
			<n-tags-select v-model:checks="formData[meta.name]" />
		</template>
		<template v-else-if="meta.type === 150">
			<n-param-select v-model:defaultIds="formData[meta.name]" />
		</template>
		<template v-else-if="meta.type === 2">
			<el-input-number v-model.number="formData[meta.name]" :placeholder="`请输入${meta.memo}`" />
		</template>
		<template v-else-if="meta.type === 210">
			<el-input-number v-model.number="formData[meta.name]" :precision="2" :placeholder="`请输入${meta.memo}`" />
		</template>
		<template v-else-if="[110, 111, 160, 161].includes(meta.type)">
			<n-upload v-model:fileKey="formData[meta.name]" :limit="[110, 160].includes(meta.type) ? 1 : 9"></n-upload>
		</template>
		<template v-else-if="meta.type === 170">
			<n-v1-address v-model="formData[meta.name]"></n-v1-address>
		</template>
		<template v-else-if="formData._address && meta.type === 171">
			<n-v1-address v-model="formData._address"></n-v1-address>
		</template>
		<template v-else>
			<el-input v-model="formData[meta.name]" :placeholder="`请输入${meta.memo}`" />
		</template>
	</el-form-item>
</template>

<script>
	import pluginPack from "../plugin-pack/plugin-pack.vue";
	
	export default {
		components: { pluginPack },
		props: {
			meta: {
				type: Object,
				require: true
			},
			formData: {
				type: Object,
				require: true
			}
		}
	}
</script>

<style>
</style>
